<script type="text/javascript" src="<?php echo RESOURCE_PATH;?>/js/jquery.validation.min.js"></script>
<header class="layout head padding-small">
    <a href="javascript:back(true);" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">售后详情</h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>
<!--售后动态S-->
<div class="radius-big bg-white padding margin height-big">
    <ul class="sale-tab border radius margin-top padding-small">
        <?php if(is_array($output['order_goods_list']) && !empty($output['order_goods_list'])) {?>
        <?php foreach ($output['order_goods_list'] as $val) { ?>
        <li class="sale-tab-list">
            <a url="<?php echo ncUrl(array('act' => 'goods', 'goods_id' => $val['goods_id']), 'goods'); ?>" class="clearfix app_onclick">
                <span class="goods-img float-left"><img src="<?php echo thumb($val, 'small'); ?>" onerror="this.src='<?php echo TEMPLATES_PATH;?>/images/touch2013/no_100_100.jpg'" class="good-img"></span>
                <span class="goods-name margin-bottom text-small margin-small-left"><?php echo $val['goods_name']; ?></span>
                <div>可退数量：<span class="text-red"><?php echo $val['goods_num']-$val['goods_returnnum']; ?></span>
                退货数量：<span class="text-red"><?php echo $val['goods_returnnum']; ?></span></div>
            </a>
        </li>
            <?php }?>
        <?php }?>
    </ul>

    <div class="clearfix">
        <span class=" text-right">退款编号：</span>
        <span class=" text-left"><?php echo $output['refund']['refund_sn']; ?></span>
    </div>
    <div class="clearfix">
        <span class=" text-right">退货时间：</span>
        <span class=" text-left"><?php echo date("Y-m-d H:i:s", $output['return']['add_time']); ?></span>
    </div>
    <div class="clearfix">
        <span class=" text-right">商城名称：</span>
        <span class=" text-left"><?php echo $output['return']['store_name']; ?></span>
    </div>
    <div class="clearfix">
        <span class=" text-right">审核状态：</span>
        <span class=" text-left"><?php echo $output['state_array'][$output['return']['return_state']]; ?></span>
    </div>
    <div class="clearfix">
        <span class=" text-right">退货数量：</span>
        <span class=" text-left"><?php echo $output['return']['return_goodsnum']; ?></span>
    </div>
    <?php if($output['return']['return_state']==3){?>
        <div class="clearfix">
            <span class=" text-right">快递名称：</span>
            <span class=" text-left"><?php echo $output['return']['shipping_name']; ?></span>
        </div>
        <div class="clearfix">
            <span class=" text-right">快递单号：</span>
            <span class=" text-left"><?php echo $output['return']['shipping_sn']; ?></span>
        </div>
    <?php }?>
    <div class="clearfix">
        <span class=" text-right">订单金额：</span>
        <span class=" text-left text-red">&yen;<?php echo $output['refund']['order_amount']; ?></span>
    </div>
    <div class="clearfix">
        <span class=" text-right">退款金额：</span>
        <span class=" text-left text-red">&yen;<?php echo $output['refund']['order_refund']; ?></span>
    </div>
    <div class="clearfix">
        <span class=" text-right">退货原因：</span>
        <span class=" text-left "><?php echo $output['return']['buyer_message']; ?></span>
    </div>
    <?php if ($output['return']['return_state'] > 1) { ?>
        <div class="clearfix">
            <span class=" text-right">卖家备注：</span>
            <span class=" text-left "><?php echo $output['return']['return_message']; ?></span>
        </div>
    <?php } ?>
    <?php if($output['return']['return_state'] == 1){?>
        <a href="javascript:return_cancel();" class="radius-big layout text-big text-center border-none bg-red text-white  " >取消退货退款</a>
    <?php }?>

    <?php if($output['return']['return_state'] == 2){?>
        <div class="">填写物流单号</div>
        <form id="post_form" method="post" action="">
            <input type="hidden" name="form_submit" value="ok" />
            <input type="hidden" name="e_name" value="" id="e_name">
            <?php if (is_array($output['express_list']) && !empty($output['express_list'])){?>
                <table class="exp_list">
                    <?php foreach ($output['express_list'] as $k=>$v){?>
                        <tr>
                            <td width="80"><?php echo str_cut($v['e_name'],8);?></td>
                            <td width="160"><input nc_type='eb' nc_value="<?php echo $k;?>" name="shipping_code" type="text" style=" width:160px;" /></td>
                            <td width="80" align="right"><a nc_type='eb' nc_value="<?php echo $k;?>" href="javascript:void(0);" class="ncu-btn2 button" e_name="<?php echo $v['e_name'];?>">确认</a></td>
                        </tr>
                    <?php }?>
                </table>
            <?php }?>
        </form>
    <?php }?>
</div>
<!--售后动态E-->

<script type="text/javascript">

function return_cancel(){
	$.getJSON('<?php echo SiteUrl?>/app/index.php?act=member_order&op=return_cancel&p=app&order_sn=<?php echo $output['return']['order_sn'];?>',{},function(data){
		Jump(data);
	});
}

$(function(){
        $("#post_form").find('input:not(:button)').focus(function(){
            $('body,html').animate({'scrollTop':$(this).offset().top-100},100);
        })
    $('a[nc_type="eb"]').live('click',function(){
        if ($('input[nc_value="'+$(this).attr('nc_value')+'"]').val() == ''){
            alert('请填写物流单号');return false;
        }
        $('input[nc_type="eb"]').attr('disabled',true);
        $('input[nc_value="'+$(this).attr('nc_value')+'"]').attr('disabled',false);
        $('#shipping_express_id').val($(this).attr('nc_value'));
        $('#e_name').val($(this).attr('e_name'));
		$.post('index.php?act=member_order&op=save_express&p=app&return_id=<?php echo $output['return']['return_id']; ?>',$('#post_form').serialize(),function(data){
			Jump(data);
		},'json');
    });
});
</script> 